using System;
using System.Collections.Generic;
using System.Text;
using ID3;
namespace JamD3
{
    class TagInfo
    {
        private ID3Info _file;
        public ID3Info file
        {
            get
            {
                return (_file = _file ?? new ID3Info(_FilePath, true));
            }
        }


        public void LoadFile(String Mp3FilePath, bool LoadExistingTagInformation)
        {
            FilePath = Mp3FilePath;
            Album = file.ID3v1Info.Album;
            Artist = file.ID3v1Info.Artist;
            Comment = file.ID3v1Info.Comment;
            Track = Convert.ToInt32(file.ID3v1Info.TrackNumber);
            Title = file.ID3v1Info.Title;
            Year = file.ID3v1Info.Year;
            return;
        }

        public void SaveToFile()
        {
            file.ID3v1Info.Album = Album;
            file.ID3v1Info.Artist = Artist;
            file.ID3v1Info.Comment = Comment;
            file.ID3v1Info.Title = Title;
            file.ID3v1Info.Year = Year;
            file.ID3v1Info.TrackNumber = Convert.ToByte(Track);
            file.Save();
        }



        private String _FilePath;
        public String FilePath
        {
            get { return _FilePath; }
            set { _FilePath = value; }
        }

        private String _Album;
        public String Album
        {
          get { return _Album; }
          set { _Album = value; }
        }
        

        private String _Artist;
        public String Artist
        {
            get { return _Artist; }
            set { _Artist = value; }
        }
        
        
        private String _Title;
        public String Title
        {
            get { return _Title; }
            set { _Title = value; }
        }
        
        
        private int _Track;
        public int Track
        {
            get { return _Track; }
            set { _Track = value; }
        }
        
        
        private String _Year;
        public String Year
        {
            get { return _Year; }
            set { _Year = value; }
        }
        
        
        private String _Comment;
        public String Comment
        {
            get { return _Comment; }
            set { _Comment = value; }
        }

    }
    

}
